package com.springcloud3.biz;

import com.springcloud3.config.Sheep;
import com.springcloud3.controller.HelloController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.function.ServerRequest;
import org.springframework.web.servlet.function.ServerResponse;

/**
 * 专门处理sheep的业务
 */
@Service
public class SheepBizHandler {
    private static final Logger logger =  LoggerFactory.getLogger(HelloController.class);

    /**
     * 查询指定ID用户
     * @param serverRequest
     * @return
     */
    public ServerResponse getSheep(ServerRequest serverRequest)throws  Exception{
        logger.info("保持山羊信息");
        //业务处理
        Sheep sheep=     new Sheep(131L,"Joe");
        //构造相应
        return ServerResponse.ok().body(sheep);
    }
    /**
     * 查询指定用户
     * @param serverRequest
     * @return
     */
    public ServerResponse getSheeps(ServerRequest serverRequest)throws  Exception{
        logger.info("保持山羊信息");

        //构造相应
        return ServerResponse.ok().build();
    }


    /**
     * 保持山羊信息
     */
    public ServerResponse saveSheep(ServerRequest serverRequest)throws  Exception{
        logger.info("保持山羊信息");
        return ServerResponse.ok().build();
    }

    /**
     * 更新
     * @param serverRequest
     * @return
     */
    public ServerResponse updateSheep(ServerRequest serverRequest)throws  Exception{
        logger.info("更新山羊信息完成");
        return ServerResponse.ok().build();
    }
    /**
     * 删除
     * @param serverRequest
     * @return
     */
    public ServerResponse deleteSheep(ServerRequest serverRequest)throws  Exception{
        logger.info("删除山羊信息成功");
        return ServerResponse.ok().build();
    }
}
